function price=continmc
Npath = 100000;
X = 0; K=4; t=0; T=1; r=0.05;
 %y = quadgk(@(s) 1/sqrt(2*pi)/v*exp(2*s-(s-my).^2/2/v^2), -Inf, Inf);
for ii=1:Npath
    X = X+max(getaX-K,0);
    disp(ii);
end

price = exp(-r*(T-t))*X/Npath;
end

function XT=getaX

t=0; T=1; r=0.05;

X=zeros(5001,1); X(1)=5; dt = (T-t)/5000; time=linspace(0,1,5001);

for ii=2:5001
    w0 = randn(1); %w1hat = randn(1); w1 = rho*w0+sqrt(1-rho^2)*w1hat;
    %Y(ii) = Y(ii-1)+1/eps*(my-Y(ii-1))*dt +v*sqrt(2)/sqrt(eps)*sqrt(dt)*w1;
   
    X(ii) = X(ii-1)+r*X(ii-1)*dt+sqrt(0.09)*X(ii-1)*time(ii-1)*sqrt(dt)*w0;
end
XT=X(5001);
end